﻿<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero" x:Class="MagnetHost.Main"
    Title="Window1" Height="Auto" Width="Auto" AllowsTransparency="True" WindowStyle="None" Background="{x:Null}" SizeToContent="WidthAndHeight" ShowInTaskbar="False">
	<Window.Resources>
		<Style x:Key="ButtonFocusVisual">
			<Setter Property="Control.Template">
				<Setter.Value>
					<ControlTemplate>
						<Rectangle Stroke="Black" StrokeDashArray="1 2" StrokeThickness="1" Margin="2" SnapsToDevicePixels="true"/>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<LinearGradientBrush x:Key="ButtonNormalBackground" EndPoint="0,1" StartPoint="0,0">
			<GradientStop Color="#F3F3F3" Offset="0"/>
			<GradientStop Color="#EBEBEB" Offset="0.5"/>
			<GradientStop Color="#DDDDDD" Offset="0.5"/>
			<GradientStop Color="#CDCDCD" Offset="1"/>
		</LinearGradientBrush>
		<SolidColorBrush x:Key="ButtonNormalBorder" Color="#FF707070"/>
		<Style x:Key="CloseButtonStyle" TargetType="{x:Type Button}">
			<Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}"/>
			<Setter Property="Background" Value="{StaticResource ButtonNormalBackground}"/>
			<Setter Property="BorderBrush" Value="{StaticResource ButtonNormalBorder}"/>
			<Setter Property="BorderThickness" Value="1"/>
			<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
			<Setter Property="HorizontalContentAlignment" Value="Center"/>
			<Setter Property="VerticalContentAlignment" Value="Center"/>
			<Setter Property="Padding" Value="1"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type Button}">
						<Grid Width="Auto">
							<Ellipse Fill="#FF000000" Stroke="#FFFFFFFF" Width="23" Height="23" StrokeThickness="2"/>
							<Path Fill="#FF000000" Stretch="Fill" Stroke="#FFFFFFFF" StrokeThickness="3" Width="3" Data="M283,8 L294.44825,27.828956" StrokeStartLineCap="Round" StrokeEndLineCap="Round" HorizontalAlignment="Center" VerticalAlignment="Center" Height="13" RenderTransformOrigin="0.5,0.5">
								<Path.RenderTransform>
									<TransformGroup>
										<ScaleTransform ScaleX="1" ScaleY="1"/>
										<SkewTransform AngleX="0" AngleY="0"/>
										<RotateTransform Angle="-45"/>
										<TranslateTransform X="0" Y="0"/>
									</TransformGroup>
								</Path.RenderTransform>
							</Path>
							<Path Fill="#FF000000" Stretch="Fill" Stroke="#FFFFFFFF" StrokeEndLineCap="Round" StrokeStartLineCap="Round" StrokeThickness="3" HorizontalAlignment="Center" VerticalAlignment="Center" Width="3" Height="13" RenderTransformOrigin="0.5,0.5" Data="M283,8 L294.44825,27.828956">
								<Path.RenderTransform>
									<TransformGroup>
										<ScaleTransform ScaleX="1" ScaleY="1"/>
										<SkewTransform AngleX="0" AngleY="0"/>
										<RotateTransform Angle="45"/>
										<TranslateTransform X="0" Y="0"/>
									</TransformGroup>
								</Path.RenderTransform>
							</Path>
						</Grid>
						<ControlTemplate.Triggers>
							<Trigger Property="IsKeyboardFocused" Value="true"/>
							<Trigger Property="ToggleButton.IsChecked" Value="true"/>
							<Trigger Property="IsEnabled" Value="false">
								<Setter Property="Foreground" Value="#ADADAD"/>
							</Trigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<Style x:Key="MinimizeButtonStyle" TargetType="{x:Type Button}">
			<Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}"/>
			<Setter Property="Background" Value="{StaticResource ButtonNormalBackground}"/>
			<Setter Property="BorderBrush" Value="{StaticResource ButtonNormalBorder}"/>
			<Setter Property="BorderThickness" Value="1"/>
			<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
			<Setter Property="HorizontalContentAlignment" Value="Center"/>
			<Setter Property="VerticalContentAlignment" Value="Center"/>
			<Setter Property="Padding" Value="1"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type Button}">
						<Grid Width="Auto">
							<Ellipse Fill="#FF000000" Stroke="#FFFFFFFF" StrokeThickness="2" Width="23" Height="23"/>
							<Path Fill="#FF000000" Stretch="Fill" Stroke="#FFFFFFFF" StrokeEndLineCap="Round" StrokeStartLineCap="Round" StrokeThickness="3" HorizontalAlignment="Center" VerticalAlignment="Center" Width="3" Height="11" RenderTransformOrigin="0.5,0.5" Data="M283,8 L294.44825,27.828956">
								<Path.RenderTransform>
									<TransformGroup>
										<ScaleTransform ScaleX="1" ScaleY="1"/>
										<SkewTransform AngleX="0" AngleY="0"/>
										<RotateTransform Angle="90"/>
										<TranslateTransform X="0" Y="0"/>
									</TransformGroup>
								</Path.RenderTransform>
							</Path>
						</Grid>
						<ControlTemplate.Triggers>
							<Trigger Property="IsKeyboardFocused" Value="true"/>
							<Trigger Property="ToggleButton.IsChecked" Value="true"/>
							<Trigger Property="IsEnabled" Value="false">
								<Setter Property="Foreground" Value="#ADADAD"/>
							</Trigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<Storyboard x:Key="MouseEnterSB">
			<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="stackPanel" Storyboard.TargetProperty="(UIElement.Opacity)">
				<SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="1" KeySpline="0,1,1,1"/>
			</DoubleAnimationUsingKeyFrames>
		</Storyboard>
		<Storyboard x:Key="MouseLeaveSB">
			<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="stackPanel" Storyboard.TargetProperty="(UIElement.Opacity)">
				<SplineDoubleKeyFrame KeyTime="00:00:01" Value="0" KeySpline="0,1,1,1"/>
			</DoubleAnimationUsingKeyFrames>
		</Storyboard>
	</Window.Resources>
	<Window.Triggers>
		<EventTrigger RoutedEvent="Mouse.MouseEnter">
			<BeginStoryboard Storyboard="{StaticResource MouseEnterSB}"/>
		</EventTrigger>
		<EventTrigger RoutedEvent="Mouse.MouseLeave">
			<BeginStoryboard x:Name="MouseLeaveSB_BeginStoryboard" Storyboard="{StaticResource MouseLeaveSB}"/>
		</EventTrigger>
	</Window.Triggers>
	<StackPanel>
		<Grid Height="30" Background="#00000000">
			<StackPanel x:Name="stackPanel" HorizontalAlignment="Right" Width="Auto" Opacity="0.005" Background="#01000000" Orientation="Horizontal">
				<Button x:Name="_minimizeBt" Cursor="Hand" HorizontalAlignment="Right" Margin="0,0,10,0" Style="{DynamicResource MinimizeButtonStyle}" Content="Button"/>
				<Button x:Name="_closeBt" Cursor="Hand" HorizontalAlignment="Right" Margin="0,0,0,0" Style="{DynamicResource CloseButtonStyle}" Content="Button"/>
			</StackPanel>
		</Grid>
		<Border x:Name="_magnetContainer" Height="Auto" BorderBrush="{x:Null}" BorderThickness="1,1,1,1" Background="#00000000" Margin="0,0,0,100"/>
	</StackPanel>
</Window>
